package com.itheima.controller;

import com.itheima.domain.db.UserInfo;
import com.itheima.domain.vo.PageBeanVo;
import com.itheima.manager.UserManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
public class UserController {
    /*
     * 实战后台
     * 用户管理模块
     * 查询用户列表
     * */
    @Autowired
    private UserManager userManager;

   /* @GetMapping("/findUserList")
    public PageBeanVo findUserList(@RequestParam(defaultValue = "1",name = "page") Integer pageNum,
                                   @RequestParam(defaultValue = "10",name = "pagesize") Integer pageSize) throws IOException {
        return userManager.findUserList(pageNum, pageSize);
    }
    *//*
     * 实战后台
     * 用户管理模块
     * 查询用户详情
     * *//*
    @GetMapping("/findUserMessages")
    public UserInfo findUserMessages(Long userId) {
        return userManager.findUserMessages( userId );
    }*/


    //城市分布表
    @GetMapping("/user/city")
    public ResponseEntity selectByCity() {
        return userManager.selectByCity();
    }

    //年龄分布表
    @GetMapping("/user/age")
    public ResponseEntity selectByAge() {
        return userManager.selectByAge();
    }

    //性别分布表
    @GetMapping("/user/gender")
    public ResponseEntity selectByGender() {
        return userManager.selectByGender();
    }

    //行业前十分布表
    @GetMapping("/user/profession")
    public ResponseEntity selectByProfession() {
        return userManager.selectByProfession();
    }
}